﻿using UnityEngine;
using System.Collections;
using Holoville.HOTween;

public class Popup_Unavailable : MonoBehaviour
{
	const float ENTER_DURATION = 0.2f;
	const float REMAIN_DURATION = 0.5f;
	const float EXIT_DURATION = 0.2f;

	AnimatedAlpha animatedAlpha;

	public void Awake()
	{
		animatedAlpha = GetComponent<AnimatedAlpha>();
		animatedAlpha.alpha = 0.0f;
	}

	void Start ()
	{
		HOTween.To (animatedAlpha, ENTER_DURATION, new TweenParms().Prop("alpha", 1.0f).Ease(EaseType.EaseInOutCubic).OnComplete(() => {
			HOTween.To (animatedAlpha, EXIT_DURATION, new TweenParms().Prop("alpha", 0.0f).Ease(EaseType.EaseInOutCubic).Delay(REMAIN_DURATION).OnComplete(() => {
				PopupManager.PopPopup();
			}));
		}));
	}
}
